package com.welsy.authoring.vo.course
{
	import com.welsy.authoring.business.TestQNames;
	import com.welsy.authoring.vo.course.pattern.*;
	import com.welsy.util.XMLUtils;
	
	[Bindable]
	public class Answer extends CourseItem
	{
		public var id:String = "0";		
		public var title:String = "0";		
		public var position:String = "0";		
		public var weight:String = "";
	    public var fileRepositoryID:String = "0";	    
	    public var fileName:String = "";

      	public function Answer() {
      	}
      	
      	public function setProperties(list:XML):void {      	
	     	this.id = list.child (TestQNames.qnAnswerID);
			this.title = list.child (TestQNames.qnTitle);
			this.position = list.child (TestQNames.qnPosition);
			this.weight = list.child (TestQNames.qnWeight);
			this.fileRepositoryID = list.child (TestQNames.qnElElementFileID);
			this.fileName = list.child (TestQNames.qnElElementFileName);        
      	}
      	
      	public function getXML ():XML {	
      		var utilsXml:XMLUtils = new XMLUtils;    	
	    	var title:String = this.title 
	    	title = utilsXml.Convert(title)
	    	var sXml:String = "<answer id='" + this.id + "' position='" + this.position + "' weight='" + this.weight + "' label='" + title + "' fileRepositoryID='" + this.fileRepositoryID + "' fileName='" + this.fileName + "'/>";
	    	return new XML (sXml);
	    }
	}
}